home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / boot / netBoot / RCS / main.c,v < prev    next >
Encoding:
Text File  |  1992-03-13  |  2.1 KB  |  104 lines

  1. head     1.1;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.1
  10. date     90.10.10.15.13.28;  author jhh;  state Exp;
  11. branches ;
  12. next     ;
  13.  
  14.  
  15. desc
  16. @@
  17.  
  18.  
  19.  
  20. 1.1
  21. log
  22. @Initial revision
  23. @
  24. text
  25. @/*-
  26.  * main.c --
  27.  *    First-level boot program for Sprite. Takes its arguments
  28.  *    and uses tftp to download the appropriate kernel image.
  29.  *
  30.  * Copyright (c) 1987 by the Regents of the University of California
  31.  *
  32.  * Permission to use, copy, modify, and distribute this
  33.  * software and its documentation for any purpose and without
  34.  * fee is hereby granted, provided that the above copyright
  35.  * notice appear in all copies.  The University of California
  36.  * makes no representations about the suitability of this
  37.  * software for any purpose.  It is provided "as is" without
  38.  * express or implied warranty.
  39.  *
  40.  *
  41.  */
  42. #ifndef lint
  43. static char rcsid[] =
  44. "$Header$ SPRITE (Berkeley)";
  45. #endif lint
  46.  
  47. #include    "boot.h"
  48.  
  49. #include    "saio.h"
  50. #include    "bootparam.h"
  51.  
  52. /*-
  53.  *-----------------------------------------------------------------------
  54.  * main --
  55.  *    Main function for downloading stuff.
  56.  *
  57.  * Results:
  58.  *    None.
  59.  *
  60.  * Side Effects:
  61.  *    Begins the booted program.
  62.  *
  63.  *-----------------------------------------------------------------------
  64.  */
  65. main() 
  66. {
  67.     register struct bootparam    *bp = *romp->v_bootparam;
  68.     struct saioreq        req;
  69.     int                  startAddr;
  70.     
  71.  
  72.     if ((strcmp(bp->bp_name, "vmunix") == 0) || (*bp->bp_name == '\0')) {
  73.     bp->bp_name = BOOT_FILE;
  74.     }
  75.  
  76.     printf ("SpriteBoot: %c%c(%x,%x,%x)%s\n",
  77.         bp->bp_dev[0], bp->bp_dev[1], bp->bp_ctlr,
  78.         bp->bp_unit, bp->bp_part, bp->bp_name);
  79.  
  80.     req.si_ctlr = bp->bp_ctlr;
  81.     req.si_unit = bp->bp_unit;
  82.     req.si_boff = (daddr_t)bp->bp_part;
  83.     req.si_boottab = bp->bp_boottab;
  84.     
  85.     if (devopen(&req)) {      /* Do all the hard work */
  86.     (*romp->v_exit_to_mon)();
  87.     }
  88.     etheropen( &req);
  89.     startAddr = tftpload(&req, bp);
  90.     devclose(&req);
  91.     
  92.     if (startAddr == -1){
  93.     (*romp->v_exit_to_mon)();
  94.     } else {
  95.     /*
  96.      * Jump to the address returned by tftpload
  97.      */
  98.     printf("Starting execution at 0x%x\n", startAddr);
  99.     startKernel(startAddr);
  100.     return(startAddr);
  101.     }
  102. }
  103. @
  104.